GUI Help > Special > setButtonImage

setButtonImage
setButtonImage [handle gadget, str fileName] | [handle gadget, int imageIndex]

Description:
Sets the image which appears on the face of a button. This can either be an image from a bitmap file, or an image already loaded into DBPro using LOAD IMAGE or GET IMAGE.

For a panel or label gadget use setPanelImage instead.

Please read the paramter descriptions below carefully, there are some important notes which you need to know in order to use this command.

Return Value:


Parameters:
gadget Handle to a button gadget
[fileName] Bitmap file to load the image from. This must be a standard windows BMP file. For other file types load the image using LOAD IMAGE, then use the imageIndex parameter instead.
Images loaded using this method will use transparency by default. The colour of the top-left hand pixel in the image will be used as the transparent colour.
[imageIndex] Instead of a filename you can specify the number of an image loaded into DBPro. For the image to work correctly, you must disable mip-mapping of the image. To do this, you should set the texture flag to 1 on the end of the LOAD IMAGE or GET IMAGE command. (Eg: LOAD IMAGE "myfile.bmp",1,1 or GET IMAGE 1,0,0,128,128,1)

Important: - In order to use this command, you must use at least one memblock command somewhere else in your program. This does not have to be in code which is actually run, it can be in a function or subroutine which you never actually use, but it must be there.
Remarks:


See Also:


Example:
(Note: You will need to include the GUI constants file for this example to work)